import sys
sys.path.append("..")

# TODO(hugs): Figure out how to run unit and system tests together.
# Currently, the mocking out in the unit tests is still in effect
# durint the system tests. We might have to fork a separate Python 
# interpreter to run the system tests for a clean slate.

if __name__ == '__main__':
    if (len(sys.argv) == 2) and (sys.argv[1] in ['unit', 'system']):
      print '\nGorb Tester'
      print '----------------------------------------------------------------------\n'
      import doctest, unittest
      
      test_suite_type =  sys.argv[1]
  
      if test_suite_type in ['unit']:
          print '** Running file tests - orb_unit_test.txt'
          suite = doctest.DocFileSuite('unit_test.txt', optionflags=doctest.ELLIPSIS)
          unittest.TextTestRunner().run(suite)
  
      if test_suite_type in ['system']:
          print '** Running system tests - orb_system_test.txt'
          suite = doctest.DocFileSuite('system_test.txt', optionflags=doctest.ELLIPSIS)
          unittest.TextTestRunner().run(suite)
    else:
      print """
  Gorb Tester 
       
  Usage: 
    When run as a script, testing options are available:
    $ python runtests.py [unit | system]
  """
